import Types from '../types';
import ThemDao from '../../expand/dao/ThemDao';

/**
 * 改变主题
 * @param {*} theme
 */
export function onThemeChange(theme) {
  return {type: Types.THEME_CHANGE, theme: theme};
}

/**
 * 初始化主题
 */
export function onThemeInit() {
  return dispatch => {
    new ThemDao().getTheme().then(data => {
      dispatch(onThemeChange(data));
    });
  };
}

/**
 * 显示自定义主题浮层
 * show: 显示或隐藏
 */

export function onShowCustomThemeView(show) {
  return {type: Types.SHOW_THEME_VIEW, customThemeViewVisible: show};
}
